home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / prim / obsolete.el.z / obsolete.el
Encoding:
Text File  |  1998-05-21  |  30.3 KB  |  700 lines

  1. ;;; obsolete.el --- obsoleteness support.
  2.  
  3. ;;;; Copyright (C) 1985-1994 Free Software Foundation, Inc.
  4. ;;;; Copyright (C) 1994, 1995 Amdahl Corporation.
  5. ;;;; Copyright (C) 1995 Sun Microsystems.
  6.  
  7. ;; Maintainer: XEmacs
  8. ;; Keywords: internal
  9.  
  10. ;; This file is part of XEmacs.
  11.  
  12. ;; XEmacs is free software; you can redistribute it and/or modify it
  13. ;; under the terms of the GNU General Public License as published by
  14. ;; the Free Software Foundation; either version 2, or (at your option)
  15. ;; any later version.
  16.  
  17. ;; XEmacs is distributed in the hope that it will be useful, but
  18. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  20. ;; General Public License for more details.
  21.  
  22. ;; You should have received a copy of the GNU General Public License
  23. ;; along with XEmacs; see the file COPYING.  If not, write to the 
  24. ;; Free Software Foundation, 59 Temple Place - Suite 330,
  25. ;; Boston, MA 02111-1307, USA.
  26.  
  27. ;;; The obsoleteness support used to be scattered throughout various
  28. ;;; source files.  We put the stuff in one place to remove the junkiness
  29. ;;; from other source files and to facilitate creating/updating things
  30. ;;; like sysdep.el.
  31.  
  32. ;;; Synched up with: Not in FSF.
  33.  
  34. (defsubst define-obsolete-function-alias (oldfun newfun)
  35.   "Define OLDFUN as an obsolete alias for function NEWFUN.
  36. This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN
  37. as obsolete."
  38.   (define-function oldfun newfun)
  39.   (make-obsolete oldfun newfun))
  40.  
  41. (defsubst define-compatible-function-alias (oldfun newfun)
  42.   "Define OLDFUN as a compatible alias for function NEWFUN.
  43. This makes calling OLDFUN equivalent to calling NEWFUN and marks OLDFUN
  44. as provided for compatibility only."
  45.   (define-function oldfun newfun)
  46.   (make-compatible oldfun newfun))
  47.  
  48. (defsubst define-obsolete-variable-alias (oldvar newvar)
  49.   "Define OLDVAR as an obsolete alias for variable NEWVAR.
  50. This makes referencing or setting OLDVAR equivalent to referencing or
  51. setting NEWVAR and marks OLDVAR as obsolete. 
  52. If OLDVAR was bound and NEWVAR was not, Set NEWVAR to OLDVAR.
  53.  
  54. Note: Use this before any other references (defvar/defcustom) to NEWVAR"
  55.   (let ((needs-setting (and (boundp oldvar) (not (boundp newvar))))
  56.         (value (and (boundp oldvar) (symbol-value oldvar))))
  57.      (defvaralias oldvar newvar)
  58.      (make-obsolete-variable oldvar newvar)
  59.      (and needs-setting (set newvar value))))
  60.  
  61. (defsubst define-compatible-variable-alias (oldvar newvar)
  62.   "Define OLDVAR as a compatible alias for variable NEWVAR.
  63. This makes referencing or setting OLDVAR equivalent to referencing or
  64. setting NEWVAR and marks OLDVAR as provided for compatibility only."
  65.   (defvaralias oldvar newvar)
  66.   (make-compatible-variable oldvar newvar))
  67.  
  68. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; device stuff
  69.  
  70. (make-compatible-variable 'window-system "use (console-type)")
  71. (make-obsolete-variable 'meta-flag
  72.             "use the `set-input-mode' function instead.")
  73.  
  74. (defun x-display-color-p (&optional device)
  75.   "Returns non-nil if DEVICE is a color device."
  76.   (eq 'color (device-class device)))
  77. (make-compatible 'x-display-color-p 'device-class)
  78.  
  79. (define-function 'x-color-display-p 'x-display-color-p)
  80. (make-compatible 'x-display-color-p 'device-class)
  81.  
  82. (defun x-display-grayscale-p (&optional device)
  83.   "Returns non-nil if DEVICE is a grayscale device."
  84.   (eq 'grayscale (device-class device)))
  85. (make-compatible 'x-display-grayscale-p 'device-class)
  86.  
  87. (define-function 'x-grayscale-display-p 'x-display-grayscale-p)
  88. (make-compatible 'x-display-grayscale-p 'device-class)
  89.  
  90. (define-compatible-function-alias 'x-display-pixel-width 'device-pixel-width)
  91. (define-compatible-function-alias 'x-display-pixel-height
  92.   'device-pixel-height)
  93. (define-compatible-function-alias 'x-display-planes 'device-bitplanes)
  94. (define-compatible-function-alias 'x-display-color-cells 'device-color-cells)
  95.  
  96. (define-obsolete-function-alias 'baud-rate 'device-baud-rate)
  97.  
  98. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; events
  99.  
  100. (define-obsolete-function-alias 'menu-event-p 'misc-user-event-p)
  101. (make-obsolete-variable 'unread-command-char 'unread-command-events)
  102. (make-obsolete 'sleep-for-millisecs "use sleep-for with a float")
  103.  
  104. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; extents
  105.  
  106. (defun extent-data (extent)
  107.   "Obsolete.  Returns the `data' property of the given extent."
  108.   (extent-property extent 'data))
  109. (make-obsolete 'set-window-dot 'set-window-point)
  110.  
  111. (defun set-extent-data (extent data)
  112.   "Obsolete.  Sets the `data' property of the given extent."
  113.   (set-extent-property extent 'data data))
  114. (make-obsolete 'set-extent-data 'set-extent-property)
  115.  
  116. (define-obsolete-function-alias 'extent-buffer 'extent-object)
  117.  
  118. (defun set-extent-attribute (extent attr &optional clearp)
  119.   "" ;; obsoleteness info will be displayed, so no need for anything more.
  120.   (cond ((eq attr 'write-protected)
  121.          (set-extent-property extent 'read-only t))
  122.         ((eq attr 'unhighlight)
  123.          (set-extent-property extent 'mouse-face nil))
  124.         ((eq attr 'writable)
  125.          (set-extent-property extent 'read-only nil))
  126.         ((eq attr 'visible)
  127.          (set-extent-property extent 'invisible nil))
  128.         (t
  129.          (set-extent-property extent attr t))))
  130. (make-obsolete 'set-extent-attribute 'set-extent-property)
  131.  
  132. (defun extent-glyph (extent)
  133.   "" ;; obsoleteness info will be displayed, so no need for anything more.
  134.   (or (extent-begin-glyph extent)
  135.       (extent-end-glyph extent)))
  136. (make-obsolete 'extent-glyph
  137.            "use `extent-begin-glyph' or `extent-end-glyph' instead.")
  138.  
  139. (defun extent-layout (extent)
  140.   "" ;; obsoleteness info will be displayed, so no need for anything more.
  141.   (extent-begin-glyph-layout extent))
  142. (make-obsolete 'extent-layout
  143.        "use `extent-begin-glyph-layout' or `extent-end-glyph-layout' instead.")
  144.  
  145. (defun set-extent-layout (extent layout)
  146.   "" ;; obsoleteness info will be displayed, so no need for anything more.
  147.   (set-extent-begin-glyph-layout extent layout))
  148. (make-obsolete 'set-extent-layout
  149.        "use `set-extent-begin-glyph-layout' or `set-extent-end-glyph-layout' instead.")
  150.  
  151. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; frames
  152.  
  153. (define-obsolete-variable-alias 'select-screen-hook 'select-frame-hook)
  154. (define-obsolete-variable-alias 'deselect-screen-hook 'deselect-frame-hook)
  155. (define-obsolete-variable-alias 'auto-raise-screen 'auto-raise-frame)
  156. (define-obsolete-variable-alias 'auto-lower-screen 'auto-lower-frame)
  157. (define-obsolete-variable-alias 'get-screen-for-buffer-default-screen-name
  158.   'get-frame-for-buffer-default-frame-name)
  159.  
  160. (define-obsolete-function-alias 'buffer-dedicated-screen
  161.   'buffer-dedicated-frame)
  162. (define-obsolete-function-alias 'deiconify-screen 'deiconify-frame)
  163. (define-obsolete-function-alias 'delete-screen 'delete-frame)
  164. (define-obsolete-function-alias 'event-screen 'event-frame)
  165. (define-obsolete-function-alias 'find-file-other-screen 'find-file-other-frame)
  166. (define-obsolete-function-alias 'find-file-read-only-other-screen
  167.   'find-file-read-only-other-frame)
  168. (define-obsolete-function-alias 'live-screen-p 'frame-live-p)
  169. (define-obsolete-function-alias 'screen-height 'frame-height)
  170. (define-obsolete-function-alias 'screen-iconified-p 'frame-iconified-p)
  171. (define-obsolete-function-alias 'screen-list 'frame-list)
  172. (define-obsolete-function-alias 'screen-live-p 'frame-live-p)
  173. (define-obsolete-function-alias 'screen-name 'frame-name)
  174. (define-obsolete-function-alias 'screen-parameters 'frame-parameters)
  175. (define-obsolete-function-alias 'screen-pixel-height 'frame-pixel-height)
  176. (define-obsolete-function-alias 'screen-pixel-width 'frame-pixel-width)
  177. (define-obsolete-function-alias 'screen-root-window 'frame-root-window)
  178. (define-obsolete-function-alias 'screen-selected-window 'frame-selected-window)
  179. (define-obsolete-function-alias 'screen-totally-visible-p
  180.   'frame-totally-visible-p)
  181. (define-obsolete-function-alias 'screen-visible-p 'frame-visible-p)
  182. (define-obsolete-function-alias 'screen-width 'frame-width)
  183. (define-obsolete-function-alias 'screenp 'framep)
  184. (define-obsolete-function-alias 'get-screen-for-buffer 'get-frame-for-buffer)
  185. (define-obsolete-function-alias 'get-screen-for-buffer-noselect
  186.   'get-frame-for-buffer-noselect)
  187. (define-obsolete-function-alias 'get-other-screen 'get-other-frame)
  188. (define-obsolete-function-alias 'iconify-screen 'iconify-frame)
  189. (define-obsolete-function-alias 'lower-screen 'lower-frame)
  190. (define-obsolete-function-alias 'mail-other-screen 'mail-other-frame)
  191. (define-obsolete-function-alias 'make-screen 'make-frame)
  192. (define-obsolete-function-alias 'make-screen-invisible 'make-frame-invisible)
  193. (define-obsolete-function-alias 'make-screen-visible 'make-frame-visible)
  194. (define-obsolete-function-alias 'modify-screen-parameters
  195.   'modify-frame-parameters)
  196. (define-obsolete-function-alias 'new-screen 'new-frame)
  197. (define-obsolete-function-alias 'next-screen 'next-frame)
  198. (define-obsolete-function-alias 'next-multiscreen-window
  199.   'next-multiframe-window)
  200. (define-obsolete-function-alias 'other-screen 'other-frame)
  201. (define-obsolete-function-alias 'previous-screen 'previous-frame)
  202. (define-obsolete-function-alias 'previous-multiscreen-window
  203.   'previous-multiframe-window)
  204. (define-obsolete-function-alias 'raise-screen 'raise-frame)
  205. (define-obsolete-function-alias 'redraw-screen 'redraw-frame)
  206. (define-obsolete-function-alias 'select-screen 'select-frame)
  207. (define-obsolete-function-alias 'selected-screen 'selected-frame)
  208. (define-obsolete-function-alias 'set-buffer-dedicated-screen
  209.   'set-buffer-dedicated-frame)
  210. (define-obsolete-function-alias 'set-screen-height 'set-frame-height)
  211. (define-obsolete-function-alias 'set-screen-position 'set-frame-position)
  212. (define-obsolete-function-alias 'set-screen-size 'set-frame-size)
  213. (define-obsolete-function-alias 'set-screen-width 'set-frame-width)
  214. (define-obsolete-function-alias 'show-temp-buffer-in-current-screen
  215.   'show-temp-buffer-in-current-frame)
  216. (define-obsolete-function-alias 'switch-to-buffer-other-screen
  217.   'switch-to-buffer-other-frame)
  218. (define-obsolete-function-alias 'visible-screen-list 'visible-frame-list)
  219. (define-obsolete-function-alias 'window-screen 'window-frame)
  220. (define-obsolete-function-alias 'x-set-screen-pointer
  221.   'set-frame-pointer)
  222. (define-obsolete-function-alias 'x-set-frame-pointer
  223.   'set-frame-pointer)
  224.  
  225. (define-obsolete-variable-alias 'screen-title-format 'frame-title-format)
  226. (define-obsolete-variable-alias 'screen-icon-title-format
  227.   'frame-icon-title-format)
  228. (define-obsolete-variable-alias 'terminal-screen 'terminal-frame)
  229. (define-obsolete-variable-alias 'delete-screen-hook 'delete-frame-hook)
  230. (define-obsolete-variable-alias 'create-screen-hook 'create-frame-hook)
  231. (define-obsolete-variable-alias 'mouse-enter-screen-hook
  232.   'mouse-enter-frame-hook)
  233. (define-obsolete-variable-alias 'mouse-leave-screen-hook
  234.   'mouse-leave-frame-hook)
  235. (define-obsolete-variable-alias 'map-screen-hook 'map-frame-hook)
  236. (define-obsolete-variable-alias 'unmap-screen-hook 'unmap-frame-hook)
  237. (define-obsolete-variable-alias 'default-screen-alist 'default-frame-alist)
  238. (define-obsolete-variable-alias 'default-screen-name 'default-frame-name)
  239. (define-obsolete-variable-alias 'x-screen-defaults 'default-x-frame-alist)
  240.  
  241. (defun x-create-screen (parms window-id)
  242.   ""
  243.   (if (not (eq 'x (device-type (selected-device))))
  244.       (error "Cannot create X frames on non-X device"))
  245.   (make-frame (append parms (list (list 'window-id window-id)))
  246.               (selected-device)))
  247. (make-obsolete 'x-create-screen 'make-frame)
  248.  
  249. (defun frame-first-window (frame)
  250.   "Returns the topmost, leftmost window of FRAME.
  251. If omitted, FRAME defaults to the currently selected frame."
  252.   (frame-highest-window frame 0))
  253. (make-compatible 'frame-first-window 'frame-highest-window)
  254.  
  255. (define-obsolete-variable-alias 'initial-frame-alist 'initial-frame-plist)
  256. (define-obsolete-variable-alias 'minibuffer-frame-alist
  257.   'minibuffer-frame-plist)
  258. (define-obsolete-variable-alias 'pop-up-frame-alist 'pop-up-frame-plist)
  259. (define-obsolete-variable-alias 'special-display-frame-alist
  260.   'special-display-frame-plist)
  261.  
  262. ;; Defined in C.
  263.  
  264. (define-obsolete-variable-alias 'default-frame-alist 'default-frame-plist)
  265. (define-obsolete-variable-alias 'default-x-frame-alist 'default-x-frame-plist)
  266. (define-obsolete-variable-alias 'default-tty-frame-alist
  267.   'default-tty-frame-plist)
  268.  
  269. (make-compatible 'frame-parameters 'frame-property)
  270. (defun frame-parameters (&optional frame)
  271.   "Return the parameters-alist of frame FRAME.
  272. It is a list of elements of the form (PARM . VALUE), where PARM is a symbol.
  273. The meaningful PARMs depend on the kind of frame.
  274. If FRAME is omitted, return information on the currently selected frame.
  275.  
  276. See the variables `default-frame-plist', `default-x-frame-plist', and
  277. `default-tty-frame-plist' for a description of the parameters meaningful
  278. for particular types of frames."
  279.   (or frame (setq frame (selected-frame)))
  280.   ;; #### This relies on a `copy-sequence' of the user properties in
  281.   ;; `frame-properties'.  Removing that would make `frame-properties' more
  282.   ;; efficient but this function less efficient, as we couldn't be
  283.   ;; destructive.  Since most callers now use `frame-parameters', we'll
  284.   ;; do it this way.  Should probably change this at some point in the
  285.   ;; future.
  286.   (destructive-plist-to-alist (frame-properties frame)))
  287.  
  288. (make-compatible 'modify-frame-parameters 'set-frame-properties)
  289. (defun modify-frame-parameters (frame alist)
  290.   "Modify the properties of frame FRAME according to ALIST.
  291. ALIST is an alist of properties to change and their new values.
  292. Each element of ALIST has the form (PARM . VALUE), where PARM is a symbol.
  293. The meaningful PARMs depend on the kind of frame.
  294.  
  295. See `set-frame-properties' for built-in property names."
  296.   ;; it would be nice to be destructive here but that's not safe.
  297.   (set-frame-properties frame (alist-to-plist alist)))
  298.  
  299. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; faces
  300.  
  301. (define-obsolete-function-alias 'list-faces-display 'edit-faces)
  302. (define-obsolete-function-alias 'list-faces 'face-list)
  303.  
  304. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; files
  305.  
  306. (make-obsolete-variable 'trim-versions-without-asking 'delete-old-versions)
  307. ;;; Old XEmacs name; kept around for compatibility.
  308. (define-obsolete-variable-alias 'after-write-file-hooks 'after-save-hook)
  309. (define-obsolete-function-alias 'truename 'file-truename)
  310.  
  311. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; hooks
  312.  
  313. (make-obsolete-variable 'auto-fill-hook 'auto-fill-function)
  314. (make-obsolete-variable 'blink-paren-hook 'blink-paren-function)
  315. (make-obsolete-variable 'lisp-indent-hook 'lisp-indent-function)
  316. (make-obsolete-variable 'comment-indent-hook 'comment-indent-function)
  317. (make-obsolete-variable 'temp-buffer-show-hook
  318.             'temp-buffer-show-function)
  319. (make-obsolete-variable 'inhibit-local-variables
  320.             "use `enable-local-variables' (with the reversed sense).")
  321. (make-obsolete-variable 'suspend-hooks 'suspend-hook)
  322. (make-obsolete-variable 'first-change-function 'first-change-hook)
  323. (make-obsolete-variable 'before-change-function
  324.   "use before-change-functions; which is a list of functions rather than a single function.")
  325. (make-obsolete-variable 'after-change-function
  326.   "use after-change-functions; which is a list of functions rather than a single function.")
  327.  
  328. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; insertion and deletion
  329.  
  330. (define-compatible-function-alias 'insert-and-inherit 'insert)
  331. (define-compatible-function-alias 'insert-before-markers-and-inherit
  332.   'insert-before-markers)
  333.  
  334. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; keymaps
  335.  
  336. (defun keymap-parent (keymap)
  337.   "Returns the first parent of the given keymap."
  338.   (car (keymap-parents keymap)))
  339. (make-compatible 'keymap-parent 'keymap-parents)
  340.  
  341. (defun set-keymap-parent (keymap parent)
  342.   "Makes the given keymap have (only) the given parent."
  343.   (set-keymap-parents keymap (if parent (list parent) '()))
  344.   parent)
  345. (make-compatible 'set-keymap-parent 'set-keymap-parents)
  346.  
  347. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; menu stuff
  348.  
  349. (defun add-menu-item (menu-path item-name function enabled-p &optional before)
  350.   "Obsolete.  See the function `add-menu-button'."
  351.   (or item-name (error "must specify an item name"))
  352.   (add-menu-button menu-path (vector item-name function enabled-p) before))
  353. (make-obsolete 'add-menu-item 'add-menu-button)
  354.  
  355. (defun add-menu (menu-path menu-name menu-items &optional before)
  356.   "See the function `add-submenu'."
  357.   (or menu-name (error (gettext "must specify a menu name")))
  358.   (or menu-items (error (gettext "must specify some menu items")))
  359.   (add-submenu menu-path (cons menu-name menu-items) before))
  360. ;; Can't make this obsolete.  easymenu depends on it.
  361. (make-compatible 'add-menu 'add-submenu)
  362.  
  363. (define-obsolete-function-alias 'popup-menu-up-p 'popup-up-p)
  364.  
  365. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; minibuffer
  366.  
  367. (define-compatible-function-alias 'read-minibuffer
  368.   'read-expression) ; misleading name
  369. (define-compatible-function-alias 'read-input 'read-string)
  370. (make-obsolete 'read-no-blanks-input 'read-string) ; mocklisp crud
  371.  
  372. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; misc
  373.  
  374. ;; (defun user-original-login-name ()
  375. ;;   "Return user's login name from original login.
  376. ;; This tries to remain unaffected by `su', by looking in environment variables."
  377. ;;   (or (getenv "LOGNAME") (getenv "USER") (user-login-name)))
  378. (define-obsolete-function-alias 'user-original-login-name 'user-login-name)
  379.  
  380. ; old names
  381. (define-obsolete-function-alias 'wholenump 'natnump)
  382. (define-obsolete-function-alias 'show-buffer 'set-window-buffer)
  383. (define-obsolete-function-alias 'buffer-flush-undo 'buffer-disable-undo)
  384. (define-obsolete-function-alias 'eval-current-buffer 'eval-buffer)
  385. (define-obsolete-function-alias 'byte-code-function-p
  386.   'compiled-function-p) ;FSFmacs
  387.  
  388. ;;(make-obsolete 'mod '%)    ; mod and % are different now
  389.  
  390. (make-obsolete 'ring-mod 'mod)
  391.  
  392. (make-obsolete 'current-time-seconds 'current-time)
  393. ;; too bad there's not a way to check for aref, assq, and nconc
  394. ;; being called on the values of functions known to return keymaps,
  395. ;; or known to return vectors of events instead of strings...
  396.  
  397. (define-obsolete-function-alias 'run-special-hook-with-args
  398.   'run-hook-with-args-until-success)
  399.  
  400. (make-obsolete-variable 'executing-macro 'executing-kbd-macro)
  401.  
  402. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; modeline
  403.  
  404. (define-compatible-function-alias 'redraw-mode-line 'redraw-modeline)
  405. (define-compatible-function-alias 'force-mode-line-update
  406.   'redraw-modeline) ;; FSF compatibility
  407. (define-compatible-variable-alias 'mode-line-map 'modeline-map)
  408. (define-compatible-variable-alias 'mode-line-buffer-identification
  409.   'modeline-buffer-identification)
  410. (define-compatible-variable-alias 'mode-line-process 'modeline-process)
  411. (define-compatible-variable-alias 'mode-line-modified 'modeline-modified)
  412. (make-compatible-variable 'mode-line-inverse-video
  413.             "use set-face-highlight-p and set-face-reverse-p")
  414. (define-compatible-variable-alias 'default-mode-line-format
  415.   'default-modeline-format)
  416. (define-compatible-variable-alias 'mode-line-format 'modeline-format)
  417. (define-compatible-variable-alias 'mode-line-menu 'modeline-menu)
  418.  
  419. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; mouse
  420.  
  421. ;;; (defun mouse-eval-last-sexpr (event)
  422. ;;;   (interactive "@e")
  423. ;;;   (save-excursion
  424. ;;;     (mouse-set-point event)
  425. ;;;     (eval-last-sexp nil)))
  426.  
  427. (define-obsolete-function-alias 'mouse-eval-last-sexpr 'mouse-eval-sexp)
  428.  
  429. (defun read-mouse-position (frame)
  430.   (cdr (mouse-position (frame-device frame))))
  431. (make-obsolete 'read-mouse-position 'mouse-position)
  432.  
  433. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; `point'
  434.  
  435. (define-obsolete-function-alias 'dot 'point)
  436. (define-obsolete-function-alias 'dot-marker 'point-marker)
  437. (define-obsolete-function-alias 'dot-min 'point-min)
  438. (define-obsolete-function-alias 'dot-max 'point-max)
  439. (define-obsolete-function-alias 'window-dot 'window-point)
  440. (define-obsolete-function-alias 'set-window-dot 'set-window-point)
  441.  
  442. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; processes
  443.  
  444. (define-obsolete-function-alias 'send-string 'process-send-string)
  445. (define-obsolete-function-alias 'send-region 'process-send-region)
  446.  
  447. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; redisplay
  448.  
  449. (defun redraw-display (&optional device)
  450.   (if (eq device t)
  451.       (mapcar 'redisplay-device (device-list))
  452.     (redisplay-device device)))
  453.  
  454. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; stuff replaced by specifiers
  455.  
  456. (defun screen-scrollbar-width (&optional screen)
  457.   ;; specifier-specs is the inverse of set-specifier, but
  458.   ;; the way this function was defined, specifier-instance
  459.   ;; is closer.
  460.   (specifier-instance scrollbar-width (or screen (selected-frame))))
  461. (make-obsolete 'screen-scrollbar-width
  462.            "use (specifier-instance scrollbar-width ...).")
  463.  
  464. (defun set-screen-scrollbar-width (screen value)
  465.   (set-specifier scrollbar-width (cons screen value)))
  466. (make-obsolete 'set-screen-scrollbar-width
  467.            "use (set-specifier scrollbar-width ...).")
  468.  
  469. (defun set-screen-left-margin-width (value &optional screen)
  470.   (set-specifier left-margin-width
  471.          (cons (or screen (selected-frame)) value)))
  472. (make-obsolete 'set-screen-left-margin-width
  473.            "use (set-specifier left-margin-width ...).")
  474.  
  475. (defun set-screen-right-margin-width (value &optional screen)
  476.   (set-specifier right-margin-width
  477.          (cons (or screen (selected-frame)) value)))
  478. (make-obsolete 'set-screen-right-margin-width
  479.            "use (set-specifier right-margin-width ...).")
  480.  
  481. (defun set-buffer-left-margin-width (value &optional buffer)
  482.   (set-specifier left-margin-width (cons (or buffer (current-buffer)) value)))
  483. (make-obsolete 'set-buffer-left-margin-width
  484.            "use (set-specifier left-margin-width ...).")
  485.  
  486. (defun set-buffer-right-margin-width (value &optional buffer)
  487.   (set-specifier right-margin-width (cons (or buffer (current-buffer)) value)))
  488. (make-obsolete 'set-buffer-right-margin-width
  489.            "use (set-specifier right-margin-width ...).")
  490.  
  491. (defun screen-left-margin-width (&optional screen)
  492.   (specifier-specs left-margin-width (or screen (selected-frame))))
  493. (make-obsolete 'screen-left-margin-width
  494.            "use (specifier-specs left-margin-width ...).")
  495.  
  496. (defun screen-right-margin-width (&optional screen)
  497.   (specifier-specs right-margin-width (or screen (selected-frame))))
  498. (make-obsolete 'screen-right-margin-width
  499.            "use (specifier-specs right-margin-width ...).")
  500.  
  501. (defun buffer-left-margin-width (&optional buffer)
  502.   (specifier-specs left-margin-width (or buffer (current-buffer))))
  503. (make-obsolete 'buffer-left-margin-width
  504.            "use (specifier-specs left-margin-width ...).")
  505.  
  506. (defun buffer-right-margin-width (&optional buffer)
  507.   (specifier-specs right-margin-width (or buffer (current-buffer))))
  508. (make-obsolete 'buffer-right-margin-width
  509.            "use (specifier-specs right-margin-width ...).")
  510.  
  511. (defun x-set-frame-icon-pixmap (frame image-instance &optional mask-ignored)
  512.   "Set the icon of the given frame to the given image instance,
  513. which should be an image instance object (as returned by
  514. `make-image-instance'), a glyph object (as returned by `make-glyph'),
  515. or nil.  If a glyph object is given, the glyph will be instantiated on
  516. the frame to produce an image instance object.
  517.  
  518. If the given image instance has a mask, that will be used as the icon mask;
  519. however, not all window managers support this.
  520.  
  521. The window manager is also not required to support color pixmaps,
  522. only bitmaps (one plane deep).
  523.  
  524. Optional third argument is ignored.  If you're concerned about this
  525. incomplete backwards incompatibility, you should convert your code
  526. to use `frame-icon-glyph' -- you can specify a mask for an XBM file
  527. using the standard image instantiator format."
  528.   (if (glyphp image-instance)
  529.       (setq image-instance (glyph-image-instance image-instance frame)))
  530.   (set-glyph-image frame-icon-glyph image-instance frame))
  531. (make-obsolete 'x-set-frame-icon-pixmap
  532.            "use (set-glyph-image frame-icon-glyph ...).")
  533. (defalias 'x-set-screen-icon-pixmap 'x-set-frame-icon-pixmap)
  534. (make-obsolete 'x-set-screen-icon-pixmap
  535.            "use (set-glyph-image frame-icon-glyph ...).")
  536.  
  537. ;;;;;;;;;;;;;;;;;;;;;;;;;;;; window-system objects
  538.  
  539. (define-obsolete-function-alias 'pixel-name 'color-name)
  540.  
  541. ;; compatibility function -- a front-end to make-glyph
  542. (defun make-pixmap (name &optional locale)
  543.   "Create a glyph with NAME as an image specifier and locale LOCALE.
  544. The file should be in `XBM' or `XPM' format.
  545. If the XBMLANGPATH environment variable is set, it will be searched for
  546.  matching files.  Next, the directories listed in the `x-bitmap-file-path'
  547.  variable will be searched (this variable is initialized from the
  548.  \"*bitmapFilePath\" resource).  Finally, the XEmacs etc/ directory
  549.  (the value of `data-directory') will be searched.
  550. The file argument may also be a list of the form (width height data) where
  551.  width and height are the size in pixels, and data is a string, containing
  552.  the raw bits of the bitmap.  (Bitmaps specified this way can only be one bit
  553.  deep.)
  554. If compiled with support for XPM, the file argument may also be a string
  555.  which is the contents of an XPM file (that is, a string beginning with the
  556.  characters \"/* XPM */\"; see the XPM documentation).
  557. The optional second argument is the specifier locale for this pixmap glyph.
  558. The returned object is a glyph object.  To get the actual pixmap object for
  559. a given frame, use the function `glyph-instance'."
  560.   (if (consp name)
  561.       (setq name (vector 'xbm :data name)))
  562.   (make-glyph name))
  563. (make-obsolete 'make-pixmap 'make-glyph)
  564.  
  565. (defun make-cursor (name &optional fg bg device)
  566.   "Creates a pointer image instance with NAME as an image specifier.
  567. The optional second and third arguments are the foreground and background
  568.  colors.  They may be color name strings or `pixel' objects.
  569. The optional fourth argument is the device on which to allocate the cursor
  570.  (defaults to the selected device).
  571. This allocates a new pointer in the X server, and signals an error if the
  572.  pointer is unknown or cannot be allocated.
  573.  
  574. A pointer name can take many different forms.  It can be:
  575.  - any of the standard cursor names from appendix B of the Xlib manual
  576.    (also known as the file <X11/cursorfont.h>) minus the XC_ prefix;
  577.  - the name of a font, and glyph index into it of the form
  578.    \"FONT fontname index [[mask-font] mask-index]\";
  579.  - the name of a bitmap or pixmap file;
  580.  - or an image instance object, as returned by `make-image-instance'.
  581.  
  582. If it is an image instance or pixmap file, and that pixmap comes with a
  583.  mask, then that mask will be used.  If it is an image instance, it must
  584.  have only one plane, since X pointers may only have two colors.  If it is a
  585.  pixmap file, then the file will be read in monochrome.
  586.  
  587. If it is a bitmap file, and if a bitmap file whose name is the name of the
  588.  pointer with \"msk\" or \"Mask\" appended exists, then that second bitmap
  589.  will be used as the mask.  For example, a pair of files might be named
  590.  \"pointer.xbm\" and \"pointer.xbmmsk\".
  591.  
  592. The returned object is a normal, first-class lisp object.  The way you
  593. `deallocate' the pointer is the way you deallocate any other lisp object:
  594. you drop all pointers to it and allow it to be garbage collected.  When
  595. these objects are GCed, the underlying X data is deallocated as well."
  596.   ;; #### ignores fg and bg
  597.   (make-image-instance name device '(pointer)))
  598. (make-obsolete 'make-cursor 'make-image-instance)
  599.  
  600. (define-obsolete-function-alias 'pixmap-width 'glyph-width)
  601. (define-obsolete-function-alias 'pixmap-contributes-to-line-height-p
  602.   'glyph-contrib-p-instance)
  603. (define-obsolete-function-alias 'set-pixmap-contributes-to-line-height
  604.   'set-glyph-contrib-p)
  605.  
  606. ;; the functionality of column.el has been moved into C
  607. (defalias 'display-column-mode 'column-number-mode)
  608.  
  609. (defun x-color-values  (color &optional frame)
  610.   "Return a description of the color named COLOR on frame FRAME.
  611. The value is a list of integer RGB values--(RED GREEN BLUE).
  612. These values appear to range from 0 to 65280 or 65535, depending
  613. on the system; white is (65280 65280 65280) or (65535 65535 65535).
  614. If FRAME is omitted or nil, use the selected frame."
  615.   (color-instance-rgb-components (make-color-instance color)))
  616. (make-compatible 'x-color-values 'color-instance-rgb-components)
  617.  
  618. ;; The name of char-int is unintuitive and silly, but in CLtL2.
  619. (define-compatible-function-alias 'char-int 'char-to-int)
  620. ;; likewise with int-char.
  621. (define-compatible-function-alias 'int-char 'int-to-char)
  622.  
  623. ;; Two loser functions which shouldn't be used.
  624. (make-obsolete 'following-char 'char-after)
  625. (make-obsolete 'preceding-char 'char-before)
  626.  
  627.  
  628. ;; The following several functions are useful in GNU Emacs 20 because
  629. ;; of the multibyte "characters" the internal representation of which
  630. ;; leaks into Lisp.  In XEmacs/Mule they are trivial and unnecessary.
  631. ;; We provide them for compatibility reasons solely.
  632.  
  633. (defun string-to-sequence (string type)
  634.   "Convert STRING to a sequence of TYPE which contains characters in STRING.
  635. TYPE should be `list' or `vector'.
  636. Multibyte characters are concerned."
  637.   (ecase type
  638.     (list
  639.      (mapcar #'identity string))
  640.     (vector
  641.      (mapvector #'identity string))))
  642.  
  643. (defun string-to-list (string)
  644.   "Return a list of characters in STRING."
  645.   (mapcar #'identity string))
  646.  
  647. (defun string-to-vector (string)
  648.   "Return a vector of characters in STRING."
  649.   (mapvector #'identity string))
  650.  
  651. (defun store-substring (string idx obj)
  652.   "Embed OBJ (string or character) at index IDX of STRING."
  653.   (let* ((str (cond ((stringp obj) obj)
  654.             ((characterp obj) (char-to-string obj))
  655.             (t (error
  656.             "Invalid argument (should be string or character): %s"
  657.             obj))))
  658.      (string-len (length string))
  659.      (len (length str))
  660.      (i 0))
  661.     (while (and (< i len) (< idx string-len))
  662.       (aset string idx (aref str i))
  663.       (setq idx (1+ idx) i (1+ i)))
  664.     string))
  665.  
  666. ;; ### This function is not compatible with FSF in some cases.  Hard
  667. ;; to fix, because it is hard to trace the logic of the FSF function.
  668. ;; In case we need the exact behaviour, we can always copy the FSF
  669. ;; version, which is very long and does lots of unnecessary stuff.
  670. (defun truncate-string-to-width (str end-column &optional start-column padding)
  671.   "Truncate string STR to end at column END-COLUMN.
  672. The optional 2nd arg START-COLUMN, if non-nil, specifies
  673. the starting column; that means to return the characters occupying
  674. columns START-COLUMN ... END-COLUMN of STR.
  675.  
  676. The optional 3rd arg PADDING, if non-nil, specifies a padding character
  677. to add at the end of the result if STR doesn't reach column END-COLUMN,
  678. or if END-COLUMN comes in the middle of a character in STR.
  679. PADDING is also added at the beginning of the result
  680. if column START-COLUMN appears in the middle of a character in STR.
  681.  
  682. If PADDING is nil, no padding is added in these cases, so
  683. the resulting string may be narrower than END-COLUMN."
  684.   (or start-column
  685.       (setq start-column 0))
  686.   (let ((len (length str)))
  687.     (concat (substring str (min start-column len) (min end-column len))
  688.         (and padding (> end-column len)
  689.          (make-string (- end-column len) padding)))))
  690.  
  691. (defalias 'truncate-string 'truncate-string-to-width)
  692. (make-obsolete 'truncate-string 'truncate-string-to-width)
  693.  
  694. ;; Keywords already do The Right Thing in XEmacs
  695. (make-compatible 'define-widget-keywords "Just use them")
  696.  
  697. (make-obsolete 'function-called-at-point 'function-at-point)
  698.  
  699. ;;; obsolete.el ends here
  700.